Xbasic

a5_ai_generate_image Function

Syntax

c a5_ai_generate_image(c namedresource, c prompt, c filename[, c extra])

Arguments

namedresource

Named resource for specifying ai server to use, api key, model and settings (should be a model that supports image generation).

prompt

Prompt to pass to the AI endpoint.

filename

Name of the image file to save locally.

extra

Provider/model specific JSON for advanced parameters (e.g., size, quality, style). Optional.

Returns

result

Indicate Success, otherwise and error string with '#Error' prefix

Description

Request an AI to generate image from text.

Example

' Note - in this case the AI provider was 'openai' and the model was 'dall-e-2'
a5_ai_generate_image("openaidalle","create a photorealistic image of a whale breaking the surface of the ocean.","c:\images\whale.png")
Whale